package com.sm.bo;

import java.util.ArrayList;
import java.util.Date;

import android.os.Parcel;
import android.os.Parcelable;

public class FreeStudent extends Student  implements Parcelable{

	private double subsciptionFees = 0.0;
	private boolean feesPayed = false;
	
	public double getSubsciptionFees() {
		return subsciptionFees;
	}

	public void setSubsciptionFees(double subsciptionFees) {
		this.subsciptionFees = subsciptionFees;
		this.feesPayed = subsciptionFees == 0.0 ? false : true;
	}

	public boolean isFeesPayed() {
		return feesPayed;
	}

//	private void setFeesPayed(boolean feesPayed) {
//		this.feesPayed = feesPayed;
//	}

	public FreeStudent() {

	}

	public FreeStudent(String nom, String adresse, String numDeTel) {
		super(nom, adresse, numDeTel);
	}

	public FreeStudent(String nom, String adresse, String numDeTel, double subsciptionFees) {
		super(nom, adresse, numDeTel);
		setSubsciptionFees(subsciptionFees);
	}
	
	@SuppressWarnings("unchecked")
	public FreeStudent(Parcel in)
	{
		super(in.readString(), in.readString(), in.readString(), new Date(in.readLong()), in.readArrayList(ArrayList.class.getClassLoader()));
		setSubsciptionFees(in.readDouble());
	}
	
	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(getName());
		dest.writeString(getAdress());
		dest.writeString(getTelNumber());
		dest.writeLong(getSubscriptionDate().getTime());
		dest.writeArray(getCourses().toArray());
		dest.writeDouble(getSubsciptionFees());
	}
	
	public static final Parcelable.Creator<FreeStudent> CREATOR = new Parcelable.Creator<FreeStudent>()
	{
		@Override
		public FreeStudent createFromParcel(Parcel source)
		{
			return new FreeStudent(source);
		}

		@Override
		public FreeStudent[] newArray(int size)
		{
			return new FreeStudent[size];
		}
	};
}
